using Microsoft.AspNetCore.Mvc;
using QiAdmin.Core;
using QiAdmin.Core.Attributes;
using QiAdmin.Core.Models;
using QiAdmin.Model.Dtos.Input;
using QiAdmin.Service.IService;

namespace QiAdmin.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TBusinessNewsController : ControllerBase
    {
        readonly ITBusinessNewsService _tBusinessNewsService;
        public TBusinessNewsController(ITBusinessNewsService tBusinessNewsService)
        {
            _tBusinessNewsService = tBusinessNewsService;
        }

        [Permission(PermissionType.Query)]
        [HttpPost]
        public ApiJsonResult GetPageList(TBusinessNews_IN input)
        {
            var res = _tBusinessNewsService.GetPageList(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Add)]
        [HttpPost]
        public ApiJsonResult Add(TBusinessNews_IN input)
        {
            var res = _tBusinessNewsService.Add(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Edit)]
        [HttpPost]
        public ApiJsonResult Edit(TBusinessNews_IN input)
        {
            var res = _tBusinessNewsService.Edit(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Query)]
        [HttpPost]
        public ApiJsonResult Get(TBusinessNews_IN input)
        {
            var res = _tBusinessNewsService.Get(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Delete)]
        [HttpPost]
        public ApiJsonResult RemoveRange(List<TBusinessNews_IN> input)
        {
            var res = _tBusinessNewsService.RemoveRange(input);
            return ApiJsonResult.Convert(res);
        }
    }
}
